home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / XPK / Source / test / testSubLibData.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-15  |  3.3 KB  |  125 lines

  1. #define NAME     "testSubLibData"
  2. #define REVISION "2"
  3.  
  4. /* Programmheader
  5.  
  6.     Name:        testSubLibData
  7.     Author:        SDI
  8.     Distribution:    PD
  9.     Description:    prints data of sub libraries
  10.     Compileropts:    -
  11.     Linkeropts:    -
  12.  
  13.  1.1   06.12.96 : excluded PrintFlag functions
  14.  1.2   15.04.97 : renamed from GetXpkSubLibData
  15. */
  16.  
  17. #include <pragma/xpksub_lib.h>
  18. #include <pragma/dos_lib.h>
  19. #include <pragma/exec_lib.h>
  20. #include <xpk/xpksub.h>
  21. #include "SDI_defines.h"
  22. #include "PrintFlags.c"
  23.  
  24. #define PARAM        "LIBID/A"
  25.  
  26. struct Library *XpkSubBase    = 0;
  27. struct RDArgs  *rda        = 0;
  28. ULONG        DosVersion    = 37;
  29.  
  30. void WriteMode(struct XpkMode *, ULONG);
  31.  
  32. void main(void)
  33. {
  34.   STRPTR name = "compressors/xpk____.library";
  35.   STRPTR str;
  36.  
  37.   if((rda = ReadArgs(PARAM, (LONG *) &str, 0)))
  38.   {
  39.     struct XpkInfo *xi;
  40.     CopyMem(str,name+15,4); // copies the LibName
  41.  
  42.     if((XpkSubBase = OpenLibrary(name, 0)) &&
  43.     (xi = XpksPackerInfo()))
  44.     {
  45.       VPrintf(
  46.       "xi_XpkInfoVersion : %d\n"
  47.       "xi_LibVersion     : %d\n"
  48.       "xi_MasterVersion  : %d\n"
  49.       "xi_ModesVersion   : %d\n"
  50.       "xi_Name           : %s\n"
  51.       "xi_LongName       : %s\n"
  52.       "xi_Description    : %s\n"
  53.       ,xi);
  54.       str = (STRPTR) &(xi->xi_ID);
  55.       VPrintf("xi_ID             : '%.4s'\nxi_Flags          : ", &str);
  56.       {
  57.         ULONG i = xi->xi_Flags;
  58.         PrintFlag(&i, XPKIF_PK_CHUNK,    "XPKIF_PK_CHUNK");
  59.         PrintFlag(&i, XPKIF_PK_STREAM,    "XPKIF_PK_STREAM");
  60.         PrintFlag(&i, XPKIF_PK_ARCHIVE,    "XPKIF_PK_ARCHIVE");
  61.         PrintFlag(&i, XPKIF_UP_CHUNK,    "XPKIF_UP_CHUNK");
  62.         PrintFlag(&i, XPKIF_UP_STREAM,    "XPKIF_UP_STREAM");
  63.         PrintFlag(&i, XPKIF_UP_ARCHIVE,    "XPKIF_UP_ARCHIVE");
  64.         PrintFlag(&i, XPKIF_HOOKIO,    "XPKIF_HOOKIO");
  65.         PrintFlag(&i, XPKIF_CHECKING,    "XPKIF_CHECKING");
  66.         PrintFlag(&i, XPKIF_PREREADHDR,    "XPKIF_PREREADHDR");
  67.         PrintFlag(&i, XPKIF_ENCRYPTION,    "XPKIF_ENCRYPTION");
  68.         PrintFlag(&i, XPKIF_NEEDPASSWD,    "XPKIF_NEEDPASSWD");
  69.         PrintFlag(&i, XPKIF_MODES,    "XPKIF_MODES");
  70.         PrintFlag(&i, XPKIF_LOSSY,    "XPKIF_LOSSY");
  71.         PrintEndFlag(i, xi->xi_Flags);
  72.       }
  73.  
  74.       VPrintf(
  75.       "xi_MaxPkInChunk   : %ld\n"
  76.       "xi_MinPkInChunk   : %ld\n"
  77.       "xi_DefPkInChunk   : %ld\n"
  78.       "xi_PackMsg        : %s\n"
  79.       "xi_UnpackMsg      : %s\n"
  80.       "xi_PackedMsg      : %s\n"
  81.       "xi_UnpackedMsg    : %s\n"
  82.       "xi_DefMode        : %d\n"
  83.       "xi_Pad            : %d\n"
  84.       ,&(xi->xi_MaxPkInChunk));
  85.       VPrintf("xi_Reserved       : %ld,%ld,%ld,%ld,%ld,%ld\n", xi->xi_Reserved);
  86.  
  87.       WriteMode(xi->xi_ModeDesc, 1);
  88.     }
  89.   }
  90.   if(XpkSubBase)
  91.     CloseLibrary(XpkSubBase);
  92.   if(rda)
  93.     FreeArgs(rda);
  94. }
  95.  
  96. void WriteMode(struct XpkMode *m, ULONG num)
  97. {
  98.   STRPTR str = (STRPTR) &(m->xm_Description);
  99.   VPrintf("\nXpkMode No %ld:\n", &num);
  100.  
  101.   VPrintf("xm_Upto           : %ld\nxm_Flags          : ", &(m->xm_Upto));
  102.   {
  103.     ULONG i = m->xm_Flags;
  104.     PrintFlag(&i, XPKMF_A3000SPEED,    "XPKMF_A3000SPEED");
  105.     PrintFlag(&i, XPKMF_PK_NOCPU,    "XPKMF_PK_NOCPU");
  106.     PrintFlag(&i, XPKMF_UP_NOCPU,    "XPKMF_UP_NOCPU");
  107.     PrintEndFlag(i, m->xm_Flags);
  108.   }
  109.  
  110.   VPrintf(
  111.   "xm_PackMemory     : %ld\n"
  112.   "xm_UnpackMemory   : %ld\n"
  113.   "xm_PackSpeed      : %ld\n"
  114.   "xm_UnpackSpeed    : %ld\n"
  115.   "xm_Ratio          : %d\n"
  116.   "xm_ChunkSize      : %d\n"
  117.   , &(m->xm_PackMemory));
  118.  
  119.   VPrintf("xm_Description    : '%.10s'\n", &str);
  120.  
  121.   if(m->xm_Next)
  122.     WriteMode(m->xm_Next, num+1);
  123. }
  124.  
  125.